<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">
    <ui:composition template="templatecustomer.xhtml">
        <ui:define name="pagename">
            Review Car Rental
        </ui:define>
        <ui:define name="content">
            <h1>REVIEW CAR RENTAL ORDER</h1>
            <br/>
            <ui:repeat value="#{carBean.cartCar}" var="cart">
                <table>
                    <tr>
                        <td><img src="../admin/#{cart.carImg}" alt="images" width="150px" height="150px"/></td>
                        <td>
                            <table>
                                <tr>
                                    <td width="130px"><b>Car Name :  </b></td>
                                    <td>#{cart.carName}</td>
                                </tr>
                                <tr>
                                    <td><b>Price :  </b></td>
                                    <td>#{cart.price}$</td>
                                </tr>
                                <tr>
                                    <td><b>Quantity :</b></td>
                                    <td>#{cart.quantity}</td>
                                </tr>
                                <tr>
                                    <td><b>Pick Up:</b> </td>
                                    <td>#{cart.pickUp}</td>
                                </tr>
                                <tr>
                                    <td><b>Drop Off: </b></td>
                                    <td>#{cart.dropOff}</td>
                                </tr>
                                <tr>
                                    <td><b>Driver: </b></td>
                                    <td>#{cart.driver}</td>
                                </tr>
                            </table>
                            <br/>
                        </td>
                    </tr>
                </table>
                <br/>
                <hr style="border:none;background-color:#dedede;color:#dedede;height:1px;"/>
                <br/>
            </ui:repeat>
            <b style="color: navy"><h:outputText value="Total: #{carBean.total}" style="margin: 0 0 0 150px"></h:outputText>$</b>
            <br></br>
            <br></br>
            <h:form>

                <c:if test="#{sessionScope.customer == null}">
                    <h:outputText style="color: red; margin: 0 0 0 150px ;text-decoration: blink" value="You must login before making checkout"></h:outputText>
                </c:if>
                <c:if test="#{sessionScope.customer != null}">
                    <table style="margin: 0 0 0 150px">
                        <tr>
                            <td>CC Number:</td>
                            <td><p:inputText id="CCNumber" value="#{bankBean.ccNumber}"></p:inputText></td>
                        </tr>
                        <tr>
                            <td>PIN Code:</td>
                            <td>
                                <p:password id="PINCode" value="#{bankBean.pinCode}"></p:password>
                            </td>
                        </tr>
                        <tr>
                            <td></td>
                            <td><b style="color: navy"><h:outputLabel id="Balance" value="#{bankBean.balance}"></h:outputLabel>$</b></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td><p:commandButton value="Check Balance" update="Balance" actionListener="#{bankBean.actionGetBalance}"></p:commandButton></td>
                        </tr>
                    </table>

                    <br></br>
                    <hr style="border:none;background-color:#dedede;color:#dedede;height:1px;margin: 0 0 0 150px"/>
                    <br/>
                    <h:commandButton style="margin: 0 0 0 150px" value="Check Out" action="#{bankBean.actionCreateCarBooking(carBean.cartCar)}"></h:commandButton>
                </c:if>
            </h:form>
        </ui:define>
    </ui:composition>
</html>

